from rest_framework import serializers

from apps.goods.models import GoodsChannel

#商品管理  频道管理 频道的增删改查
class GoodsChannelSerializer(serializers.ModelSerializer):
    group = serializers.StringRelatedField(read_only=True)
    group_id = serializers.IntegerField()
    category = serializers.StringRelatedField(read_only=True)
    category_id = serializers.IntegerField()
    class Meta:
        model = GoodsChannel
        fields = "__all__"
#商品管理  频道管理 频道组查询
class GoodsChannelsSimpleSerializer(serializers.Serializer):
    id = serializers.IntegerField()
    name = serializers.CharField()
# 商品管理  频道管理  一级分类查询
class GoodsCategorySimpleSerializer(serializers.Serializer):
    id = serializers.IntegerField()
    name = serializers.CharField()